import {Button, Input, Text, View, Image} from '@tarojs/components';
import Taro, {getCurrentInstance} from '@tarojs/taro';
import React, {Component} from 'react';
import 'taro-ui/dist/style/components/action-sheet.scss';
import {connect} from 'react-redux';
import './index.less';
import * as T from './types';
import actions from './actions';
import {store2Props} from './selectors';
import LoginForm from './components/login-form';
import OtherLogin from './components/other-login';
import arrowIcon from '@/assets/image/login/r-arrow.png';
import {WMkit} from 'wmkit';
actions().actions.loadReducer();
//@ts-ignore
@connect<Partial<T.IProps>, any>(store2Props, actions)
export default class LoginLogin extends Component<Partial<T.IProps>, any> {
  componentWillMount() {
    Taro.setNavigationBarTitle({title: '登录'});
    if (__TARO_ENV !== 'h5') {
      Taro.showShareMenu({
        withShareTicket: true,
      });
    }
  }

  componentDidShow() {
    let {mobile} = getCurrentInstance().router.params || {};
    this.props.actions.init(mobile);
  }

  componentWillUnmount() {
    this.props.actions.clean();
  }

  render() {
    let {main} = this.props;
    if (!main) return null;
    return (
      <View className="loginLogin">
        <OtherLogin />
      </View>
    );
  }
}
